package com.cmxh.shipper.controller;

import com.cmxh.shipper.pojo.Cargo;
import com.cmxh.shipper.service.CargoService;
import com.cmxh.shipper.util.Code;
import com.cmxh.shipper.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/cargo")
public class CargoController {
    @Autowired
    private CargoService cargoService;

    @RequestMapping("/selectAll")
    public Result selectAll() {
        List<Cargo> cargos = cargoService.selectAll();
        if (cargos != null) {
            return new Result(Code.GET_OK,cargos, "查询成功");
        } else {
            return new Result(Code.GET_ERR, "查询失败");
        }
    }
}
